C.S.M.P. Digest Sat, 20 Feb 93 Volume 2 : Issue 14 Today's Topics: LDEF sample Resource compression/decompression Where do I get the highlight color? List Manager help wanted File system problem - RstLock not updating... How to check for gray-scale screen? The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly. The digest is a collection of article threads from the usenet newsgroup comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi- regularly and want an archive of the discussions. If you don't know what a newsgroup is, you probably don't have access to it. Ask your systems administrator(s) for details. If you don't have access to news, you can post articles to any newsgroup by mailing your article to newsgroup@cs.utexas.edu So, to post an article to comp.sys.mac.programmer, mail your article to comp-sys-mac-programmer@cs.utexas.edu Note the '-' instead of '.' in the newsgroup name. Be sure to ask that replies be emailed to you instead of posted to the group, and give your email address. Each issue of the digest contains one or more sets of articles (called threads), with each set corresponding to a 'discussion' of a particular subject. The articles are not edited; all articles included in this digest are in their original posted form (as received by our news server at cs.uoregon.edu). Article threads are not added to the digest until the last article added to the thread is at least one month old (this is to ensure that the thread is dead before adding it to the digest). Article threads that consist of only one message are generally not included in the digest. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu [128.223.8.8] in the directory /pub/mac/csmp-digest. Be sure to read the file /pub/mac/csmp-digest/README before downloading any files. The most recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the directory /info-mac/digest/csmp. If you don't have ftp capability, the sumex archive has a mail server; send a message with the text '$MACarch help' (no quotes) to LISTSERV@ricevm1.rice.edu for more information. The digest is also available via email. Just send a note saying that you want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will automatically receive each new issue as it is created. Sorry, back issues are not available through the mailing list. Send administrative mail to mkelly@cs.uoregon.edu. ------------------------------------------------------- From: winer@husc10.harvard.edu (Adam Winer) Subject: LDEF sample Date: 20 Jan 93 07:57:24 GMT Here's that LDEF I promised (my apologies for the word wrap): /* This code is modified from the code sicnLDEF, which is somewhere */ /* in the sample code directory at ftp.apple.com */ /* It (should) behave exactly like the standard LDEF: if it doesn't, or */ /* if it fails to work at all, write me at winer@husc.harvard.edu */ /* NB: I _haven't_ tested this code */ /* Please note the comments in the code indicating what portions of */ /* the code should be commented out in order to remove either */ /* the automatic condensing or the automatic ellipsis removing */ /* A suggestion to beginning LDEF programmers: try modifying the code */ /* slightly: for example, use a couple of bytes at the beginning of */ /* the data you pass in to store style and font info. This way, */ /* every cell can have its own font and style! */ /* There's a lot of things you can't do with LDEF's, like have variable */ /* width columns, but there are plenty of things you can do. */ /* Just start from a simple LDEF, and think about what needs to be done */ /* to draw a cell, and to highlight a cell */ /* constants for spacing */ #define kLeftOffset 2 #define kTopOffset 0 #define TRUE 1 #define FALSE 0 /* main LDEF entry point */ pascal void main(short lMessage,Boolean lSelect,Rect *lRect,Cell lCell, short lDataOffset,short lDataLen,ListHandle lHandle) { FontInfo fontInfo; /* font information (ascent/descent/etc) */ ListPtr listPtr; /* pointer to store dereferenced list */ SignedByte hStateList,hStateCells; /* state variables for HGetState/SetState */ Ptr cellData; /* points to start of cell data for list */ short leftDraw,topDraw; /* left/top offsets from topleft of cell */ short i; short wayleft,middle,sndLeftDraw; short shrunk; /* lock and dereference list mgr handles */ hStateList = HGetState(lHandle); HLock(lHandle); listPtr = *lHandle; hStateCells = HGetState(listPtr->cells); HLock(listPtr->cells); cellData = *(listPtr->cells); switch (lMessage) { case lInitMsg: /* we don't need any initialization */ break; case lDrawMsg: EraseRect(lRect); if (lDataLen > 0) { i=lDataLen; /* determine starting point for drawing */ wayleft=lCell.h*listPtr->cellSize.h+(listPtr->rView.left); leftDraw = wayleft+listPtr->indent.h+kLeftOffset; topDraw = lRect->top+listPtr->indent.v+kTopOffset; GetFontInfo(&fontInfo); MoveTo(leftDraw,topDraw+fontInfo.ascent); /* set condensed mode if necessary (if the text */ /* doesn't fit otherwise) */ TextFace(0); shrunk=FALSE; /* to get rid of condensing+ellipsis comment out until */ /* before DrawText */ if (TextWidth(cellData,lDataOffset,i) > (middle - leftDraw)) { /* to get rid of condensing _only_, comment out the */ /* next line */ TextFace(condense); /* to get rid of ellipsis _only_, comment out the */ /* next 5 lines */ while (TextWidth(cellData,lDataOffset,i+1) > (middle - leftDraw)) { shrunk=TRUE; i--; } } if (shrunk) cellData[lDataOffset+i-1]='...'; /* These three dots should be option-semicolon in */ /* practice, but it wouldn't show up on UNIX */ DrawText(cellData,lDataOffset,i); } if (!lSelect) /* if the cell is selected, then use the hiliting */ /* procedure to do the inversion */ break; case lHiliteMsg: /* do hilite color */ BitClr(&HiliteMode,pHiliteBit); InvertRect(lRect); break; case lCloseMsg: break; } HSetState(listPtr->cells,hStateCells); HSetState(lHandle,hStateList); } - -- Adam Winer | The number you have reached is imaginary. WINER@HUSC.HARVARD.EDU | Please rotate your phone 90 degrees and | try again. --------------------------- From: juggler@netcom.com (Chris Calande) Subject: Resource compression/decompression Organization: Netcom - Online Communication Services (408 241-9760 guest) Date: Sat, 16 Jan 1993 03:31:50 GMT The resource manager can now decompress resources. Does anybody know if there is anything (code examples, application, etc.) that will let us compress our resources or is Apple the only one able to take advantage of this feature of the resource manager.? Thanks in advance, Scott juggler@netcom2.netcom.com +++++++++++++++++++++++++++ From: wysocki@netcom.com (Chris Wysocki) Organization: Connectix Corporation, San Mateo, CA Date: Sat, 16 Jan 1993 09:03:40 GMT In article <1993Jan16.033150.23822@netcom.com> juggler@netcom.com (Chris Calande) writes: >The resource manager can now decompress resources. Does anybody know if >there is anything (code examples, application, etc.) that will let us >compress our resources or is Apple the only one able to take advantage >of this feature of the resource manager.? There is an article in the January MacTech (formerly MacTutor) about resource compression. It describes how the Resource Manager handles compressed resources as well as how to implement your own resource compressor. If you're looking for an off-the-shelf product to compress resources for you, check out VISE from MindVision. I believe that some of the major compression applications can also do resource compression, but I haven't personally used any of them. Chris. - -- - ------------------------------------------------------------------------------ Chris Wysocki Internet: wysocki@netcom.com Software Engineer America Online: AFA ChrisW Connectix Corporation CompuServe: 72010,1140 +++++++++++++++++++++++++++ From: seth@physc1.byu.edu Date: 15 Jan 93 23:57:28 -0700 Organization: Brigham Young University In article <1993Jan16.033150.23822@netcom.com>, juggler@netcom.com (Chris Calande) writes: > The resource manager can now decompress resources. Does anybody know if > there is anything (code examples, application, etc.) that will let us > compress our resources or is Apple the only one able to take advantage > of this feature of the resource manager.? > > Thanks in advance, > > Scott > > juggler@netcom2.netcom.com > If you look at the dialog that comes up if you hit the "Get Resource Info" menu command while looking at a particular resource, one of the options available with its check-box is compression. I haven't ever checked this box, but I know it is there. Seth Leigh BYU Physics Dept. +++++++++++++++++++++++++++ Organization: Royal Institute of Technology, Stockholm, Sweden Date: Sat, 16 Jan 1993 19:50:57 GMT In <1993Jan15.235728.343@physc1.byu.edu> seth@physc1.byu.edu writes: >> The resource manager can now decompress resources. Does anybody know if >> there is anything (code examples, application, etc.) that will let us >> compress our resources or is Apple the only one able to take advantage >If you look at the dialog that comes up if you hit the "Get Resource Info" menu >command while looking at a particular resource, one of the options available >with its check-box is compression. I haven't ever checked this box, but I know >it is there. Checking the box won't compress the resource. Apple has not released the resource compression info to the public (though certain companies have reverse-engineered it) This was because of the time constraint; resource compression was sort of a hack to get a System 7 on a HD floppy. re cleaning it up, modularizing it (as always :-) and will release info for developers "sometime." In the meantime, you can always head-patch GetResource to do the thing for you. Head patch, you say? Well, a patch that looks something like: SetResLoad ( 0 ) ; h = GetIntendedResource ( ) ; if ( ! * h ) { LoadResource ( h ) ; if ( * h ) { UncompressMyFormat ( h ) ; } } SetResLoad ( 1 ) ; JMP GetResource <- This will find the already loaded resource! I think Kent Borg was the guy who came up with this genial solution; hope he doesn't mind sharing it (at least he gets the credit :-) You probably have to patch GetIndResource, GetNamedResource, LoadResource etc as well. Cheer,s / h+ - -- -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe -- NCC-1701 +++++++++++++++++++++++++++ From: kent@lloyd.Camex.COM (Kent Borg) Organization: Camex Inc., Boston MA Date: Sat, 16 Jan 1993 22:45:25 EST tte) writes: |>In <1993Jan15.235728.343@physc1.byu.edu> seth@physc1.byu.edu writes: |> |>>> The resource manager can now decompress resources. Does anybody know if |>>> there is anything (code examples, application, etc.) that will let us |>>> compress our resources or is Apple the only one able to take advantage |>Apple has not released the resource compression info to the |>public (though certain companies have reverse-engineered it) |>This was because of the time constraint; resource compression |>was sort of a hack to get a System 7 on a HD floppy. |> re cleaning it up, modularizing |>it (as always :-) and will release info for developers "sometime." |> |>In the meantime, you can always head-patch GetResource to do |>the thing for you. Head patch, you say? Well, a patch that |>looks something like: |> SetResLoad ( 0 ) ; |> h = GetIntendedResource ( ) ; |> if ( ! * h ) { |> LoadResource ( h ) ; |> if ( * h ) { |> UncompressMyFormat ( h ) ; |> } |> } |> SetResLoad ( 1 ) ; |> JMP GetResource <- This will find the already loaded resource! |>I think Kent Borg was the guy who came up with this genial |>solution; hope he doesn't mind sharing it (at least he |>gets the credit :-) Yes, I posted related stuff once and credit is always nice, thanks. (But was it really MacDTS that suggested it? I forget. For good measure, give them credit too--it spreads the blame...) |>You probably have to patch GetIndResource, GetNamedResource, |>LoadResource etc as well. And that is a problem. There are lots of ways of get resources, growing all the time, and trying to catch them all, for everybody, always, is tricky. If you have a specific resource you want to have an INIT tamper with before letting the Real Application see it (like a 'PREC' 103 in printing--my case) shinanigans like mine might be for you. If you just want to decompress resources, look at the January 1993 MacTutor aka MacTech article. Apple can't break their own scheme anytime soon without breaking all the 7.0 floppies they shipped. Sure, they might do a better (read: bigger, meaner) solution, but if this one works now and plans to keep working, why not use it? [The 7.0 resource compression scheme in summary, via Justin Gray of Alysis in MacTech: Put a 'dcmp' code resource in your file (great new virus vector!) that knows how to decompress your resource, then mark your compressed resource as compressed and point to the correct 'dcmp'. And when anyone wants it through any calls, you do some fast "single-buffer" decompression and they are there.] - -kb, listening to classical music - -- Kent Borg kent@camex.com or kentborg@aol.com (when it is *working*) H:(617) 776-6899 W:(617) 426-3577 The Quote that usually appears here will not be seen so that we can bring you the following message: Camex is collapsing, so any Hot Job offers... +++++++++++++++++++++++++++ From: bwilliam@iat.holonet.net (Bill Williams) Organization: HoloNet National Internet Access BBS: 510-704-1058/modem Date: Mon, 18 Jan 1993 00:44:24 GMT I know a developer who liscnses his resource compression technologies for mac applications and resources. Using them you can shrink the size of your application dramatically. Also using good compression in your application can make it load faster, especially from floppies or on fast machines. The developer I am speaking of has compression faster loading, and smaller, than all known resource compression technologies. (Using Norton utilities as the benchmark application.) Over 400,000 und users have run his code in varioius products, but as advertising is frowned upon on the Internet, you should contact me via E-mail for his company number, prices, specs, etc. PS. His resource compression is not only the smallest out there, it also makes some applications smaller than when compressed with traditional, non-resource compression technologies such as Compact Pro 1.33, etc.!!! He also has a near-100% resource compressed system 6.08, microfinders, better compression of System 7, compressed finders, micro-Finders, etc. All for people who need to distribute utility software. Bill Williams --------------------------- From: ctvien@cs.concordia.ca (VIEN cam thanh) Subject: Where do I get the highlight color? Date: 18 Jan 93 01:57:25 GMT Organization: Computer Science, Concordia University, Montreal, Quebec How can I get the highlight color defined in the color control panel? or any information set in the contol panels for that matter. (i.e. the location of the Mac in the Map control panel) Thanks Cam +++++++++++++++++++++++++++ From: ross@bnr.ca (Ross Brown) Organization: Bell-Northern Research Ltd. Date: Mon, 18 Jan 1993 16:21:21 GMT In article <5650@daily-planet.concordia.ca> ctvien@cs.concordia.ca (VIEN cam thanh) writes: >How can I get the highlight color defined in the color control panel? >or any information set in the contol panels for that matter. (i.e. >the location of the Mac in the Map control panel) There's no standard method for all control panel settings, but I'll give you a direct answer to your question about getting the highlight color: rgbColor = (*((GVarHandle)someCGrafPtr->grafVars))->rgbHiliteColor; ...but make sure it's really a color GrafPort before you do this. ============================================================================== Ross Brown, Dept. 7C22 < Bell-Northern Research > Just the facts, ma'am. Advisor, Telemgmt Svcs < P. O. Box 3511, Station C > We don't care whose ross@bnr.ca < Ottawa, ON, Canada K1Y 4H7 > opinions yours aren't. ============================================================================== +++++++++++++++++++++++++++ From: christopher m. knox Organization: Pre-Press Technologies, Inc. Date: Mon, 18 Jan 1993 17:20:34 GMT Subject: Where do I get the highlight color? From: VIEN cam thanh, ctvien@cs.concordia.ca In article <5650@daily-planet.concordia.ca> VIEN cam thanh, ctvien@cs.concordia.ca writes: >How can I get the highlight color defined in the color control panel? Hi, the highlight color is in a global variable: RGBColor HiliteRGB; Chris chris knox, primary programmer, SpectreTouch "Omne animal triste est post (or without) coitum" Umberto Eco +++++++++++++++++++++++++++ From: peirce@outpost.SF-Bay.org (Michael Peirce) Date: 18 Jan 93 17:58:17 GMT Organization: Peirce Software In article <5650@daily-planet.concordia.ca> (comp.sys.mac.programmer), ctvien@cs.concordia.ca (VIEN cam thanh) writes: > How can I get the highlight color defined in the color control panel? > or any information set in the contol panels for that matter. (i.e. > the location of the Mac in the Map control panel) It lives at low mmeory $0DA0. Here's an old piece of Pascal code I have that uses it: BlockMove(Ptr($0DA0),@hiLiteColor,SIZEOF(RGBColor)); RGBForeColor(hiLiteColor); hiLiteColor is declared as an RGBColor. - -- Michael Peirce -- peirce@outpost.SF-Bay.org - -- Peirce Software -- Suite 301, 719 Hibiscus Place - -- -- San Jose, California USA 95117 - -- Makers of: -- voice: (408) 244-6554 fax: (408) 244-6882 - -- Smoothie -- AppleLink: peirce & America Online: AFC Peirce --------------------------- From: hd12@ellis.uchicago.edu Subject: List Manager help wanted Date: 4 Jan 93 06:19:05 GMT Organization: University of Chicago I like to creat a list containing file names, size, date etc. Each entry should be in a single cell. After I put file name in the cell using LSetCell, I have to add size, date etc. in the same cell. Although I can use LAddToCell to do that but that will make the size field not aligned vertically. Anyone know an elegent way to handle this? Thank you very much. BTW. I am using Think C 5.0.3, have lots of trouble with C and Pascal strings. Suppose I have: Str255 mystring; Use: mystring="\p Something "; doesn't work. How could I assign a string to the variable mystring? +++++++++++++++++++++++++++ From: Sproul@sproul.sproul.com (Mark Sproul) Date: 5 Jan 93 16:48:10 GMT Organization: Sproul Consulting In article <1993Jan4.061905.14455@midway.uchicago.edu> (comp.sys.mac.programmer), hd12@ellis.uchicago.edu writes: > I like to creat a list containing file names, size, date etc. Each entry > should be in a single cell. After I put file name in the cell using > LSetCell, I have to add size, date etc. in the same cell. Although I can > use LAddToCell to do that but that will make the size field not aligned > vertically. Anyone know an elegent way to handle this? Thank you very much. > > BTW. I am using Think C 5.0.3, have lots of trouble with C and Pascal strings. > Suppose I have: Str255 mystring; > Use: mystring="\p Something "; doesn't work. How could I assign a string to the > variable mystring? > To do what you want, first BEFORE creating the list, set the font for that list to Monoco. This will set it to a mono-space font. Any other monospace font will work as well. next, with the file name do the following Str255 fName; //* i assume you have a Pascal file name char lineBuf[128]; PtoCstr(fName); sprintf(lineBuf, "%-32s", fName); //* this will put the file name left justfied in the string, padded with spaces, change the number as you need. dataLen = strlen(lineBuf); LSetCell(lineBuf,dataLen, ....etc When you do your LAddToCell(), do it in similar manner. One hint, I just discovered this morning that if the text is longer than the entire width of the window, it will condense the type to make it fit. On your other question, as far as I know, Think C does not support, mystring="\p Something "; use strcpy(mystring, " Something "); CtoPstr(mystring); or sprintf(mystring, "\p Something "); be sure to #include #include and Link ANSI - ----------------------------------------------------- Mark Sproul - KB2ICI - New Jersey sproul@sproul.com +++++++++++++++++++++++++++ From: hardin@dino.mcc.com (John Hardin) Organization: MCC ISD, Austin, Texas Date: Thu, 7 Jan 1993 05:16:14 GMT Mark Sproul (Sproul@sproul.sproul.com) writes: > > On your other question, as far as I know, Think C does not support, > mystring="\p Something "; > ThinkC DOES, in fact, support Pascal string literals. P. 206 of the ThinkC 5 manual states "To write a Pascal string constant, start the string with "\P" or "\p"." - -jwh - -- John W. Hardin phone: (512)338-3535 MCC email: hardin@mcc.com 3500 W. Balcones Center Dr fax: (512)338-3897 Austin, TX 78759-6509 uucp: ...!cs.utexas.edu!milano!hardin +++++++++++++++++++++++++++ From: bowman@reed.edu (BoBolicious) Organization: Reed College, Portland, OR Date: Thu, 7 Jan 1993 07:23:35 GMT In article hardin@dino.mcc.com (John Hardin) writes: >Mark Sproul (Sproul@sproul.sproul.com) writes: >> On your other question, as far as I know, Think C does not support, >> mystring="\p Something "; >ThinkC DOES, in fact, support Pascal string literals. P. 206 of the >ThinkC 5 manual states "To write a Pascal string constant, start the >string with "\P" or "\p"." I missed the beginning of this thread, where mystring was apparently defined, but perhaps the key is that: mystring = "\p somthing"; works if mystring is declared as an unsigned char *. It *doesn't* work if mystring is a Str255 or any other array construct where the actual storage is allocated on the stack. cheers, bobo In seeking the unattainable, bowman@reed.edu simplicity only gets in the way. "On Monday, numbers floated everywhere, and the world was full of approximations." -- Spencer Heinz, _The Oregonian_, 1/5/93 +++++++++++++++++++++++++++ From: peter@cujo.curtin.edu.au (Peter N Lewis) Organization: Curtin University of Technology Date: Thu, 7 Jan 1993 13:37:40 GMT Sproul@sproul.sproul.com (Mark Sproul) writes: >In article <1993Jan4.061905.14455@midway.uchicago.edu> (comp.sys.mac.programmer), hd12@ellis.uchicago.edu writes: >> I like to creat a list containing file names, size, date etc. Each entry >> should be in a single cell. After I put file name in the cell using >> LSetCell, I have to add size, date etc. in the same cell. Although I can >> use LAddToCell to do that but that will make the size field not aligned >> vertically. Anyone know an elegent way to handle this? Thank you very much. >To do what you want, first BEFORE creating the list, set the font >for that list to Monoco. This will set it to a mono-space font. >Any other monospace font will work as well. That will work, but you can write your own LDEF to display any information in any format you like. An LDEF is probably the simplest proc code you can write. You can get some pascal sample LDEF code with my Talk source code on sumex-aim.stanford.edu:/info-mac/source/pascal. There is probably some sample code on ftp.apple.com:/dts/mac/sc somewhere. The normal technique is to store a record/struct of the information you want and then write an LDEF proc to display it. Good luck, Peter. - -- _______________________________________________________________________ Peter N Lewis Ph: +61 9 368 2055 +++++++++++++++++++++++++++ From: larrym@mtxinu.COM (Larry Meyer) Date: 8 Jan 93 23:38:33 GMT Organization: mt Xinu, Berkeley, CA In article Sproul@sproul.sproul.com (Mark Sproul) writes: > >In article <1993Jan4.061905.14455@midway.uchicago.edu> (comp.sys.mac.programmer), hd12@ellis.uchicago.edu writes: >One hint, I just discovered this morning that if the text is longer >than the entire width of the window, [ListMgr] will condense the type to >make it fit. > Wow, and I though I was just doing something stupid. I encountered this condensing "feature" recently, and I haven't been able to the goddamn thing off. (No using a monospace font does not work). As far as I can tell, this condensing only occurs when you use Lists in a Modal Dialog (leading me to suspect that this is some hack introduced to aid in displaying long file names in the StdFileDlog, or something like that). The reason I want it off is that I'm displaying columnar data in a List, and when ListMgr condenses it, it throws off alignment with column headers (Yeah, I know I can put the data into individual cells, but its not worth the effort in this situation). Does anyone out there know how to turn off this "feature"? - -- /---------------------------------------------------- Larry Meyer Mac/Unix Programmer @ Xinet, Berkeley CA larrym@xinet.com (ask me about max<->unix stuff) - -----------------------------------------------------/ +++++++++++++++++++++++++++ From: chuck@gte.com (Chuck Hoffman) Date: 14 Jan 93 14:57:25 GMT Organization: GTE Laboratories In article <1993Jan8.233833.3887@mtxinu.COM>, larrym@mtxinu.COM (Larry Meyer) wrote: > > In article Sproul@sproul.sproul.com (Mark Sproul) writes: > > > >In article <1993Jan4.061905.14455@midway.uchicago.edu> (comp.sys.mac.programmer), hd12@ellis.uchicago.edu writes: > >One hint, I just discovered this morning that if the text is longer > >than the entire width of the window, [ListMgr] will condense the type to > >make it fit. > > > > Wow, and I though I was just doing something stupid. I encountered > this condensing "feature" recently, and I haven't been able to the > goddamn thing off. (No using a monospace font does not work). > As far as I can tell, this condensing only occurs when > you use Lists in a Modal Dialog (leading me to suspect that this > is some hack introduced to aid in displaying long file names > in the StdFileDlog, or something like that). List Manager does this to lists in regular windows, too. If condensing the text is not enough to make it fit, LM will also truncate the text and put an elipsis "..." at the end of the part that gets displayed. What I would like is to turn off the condensing part, and leave on the truncation / elipsis part. Does anyone know how? Chuck Hoffman chuck@gte.com GTE Laboratories, Waltham, Massachusetts, USA (617) 466-2131 ===================================== I'm not sure why we're here, but I am sure that while we're here we're supposed to help each other. ===================================== +++++++++++++++++++++++++++ From: kurisuto@bach.udel.edu (Sean J. Crist) Organization: University of Delaware Date: Thu, 14 Jan 1993 23:33:45 GMT In article chuck@gte.com (Chuck Hoffman) writes: >In article <1993Jan8.233833.3887@mtxinu.COM>, larrym@mtxinu.COM (Larry >Meyer) wrote: >> In article Sproul@sproul.sproul.com (Mark Sproul) writes: >> >In article <1993Jan4.061905.14455@midway.uchicago.edu> (comp.sys.mac.programmer), hd12@ellis.uchicago.edu writes: >> >One hint, I just discovered this morning that if the text is longer >> >than the entire width of the window, [ListMgr] will condense the type to >> >make it fit. >> Wow, and I though I was just doing something stupid. I encountered >> this condensing "feature" recently, and I haven't been able to the >> goddamn thing off. (No using a monospace font does not work). >> As far as I can tell, this condensing only occurs when >> you use Lists in a Modal Dialog (leading me to suspect that this >> is some hack introduced to aid in displaying long file names >> in the StdFileDlog, or something like that). >List Manager does this to lists in regular windows, too. If condensing the >text is not enough to make it fit, LM will also truncate the text and put >an elipsis "..." at the end of the part that gets displayed. What I would >like is to turn off the condensing part, and leave on the truncation / >elipsis part. Does anyone know how? I wasn't aware of this feature, but it would seem that this behavior must be a part of the standard LDEF, since the List Manager proper has no knowledge of the meaning of the data in the cells or the way that those data are drawn by the LDEF. (How would the List Manager 'condense' cells where the data are icons rather than text, for example?) If this assumption is correct, then my recommendation would be just to write your own LDEF to display text as you like it. This ought to be pretty simple and straightforward to write. I wonder if this text-condensing LDEF is some new version written for System 7. I haven't observed this behavior in earlier systems. \/ __ __ _\_ Kurisuto (Sean Crist) --- | | \ / Department of Linguistics _| ,| ,| ----- University of Delaware _| ,| ,| [_] kurisuto@chopin.udel.edu | | | [_] Discl: I speak for myself. +++++++++++++++++++++++++++ From: peter@cujo.curtin.edu.au (Peter N Lewis) Organization: NCRPDA, Curtin University Date: Fri, 15 Jan 1993 06:32:54 GMT In article , chuck@gte.com (Chuck Hoffman) wrote: > > In article <1993Jan8.233833.3887@mtxinu.COM>, larrym@mtxinu.COM (Larry > Meyer) wrote: > > Wow, and I though I was just doing something stupid. I encountered > > this condensing "feature" recently, and I haven't been able to the > > goddamn thing off. (No using a monospace font does not work). > > As far as I can tell, this condensing only occurs when > > you use Lists in a Modal Dialog (leading me to suspect that this > > is some hack introduced to aid in displaying long file names > > in the StdFileDlog, or something like that). > > List Manager does this to lists in regular windows, too. If condensing the > text is not enough to make it fit, LM will also truncate the text and put > an elipsis "..." at the end of the part that gets displayed. What I would > like is to turn off the condensing part, and leave on the truncation / > elipsis part. Does anyone know how? You could always do it the good old fashioned way - add the elipse on yourself if necessary and use StringWidth to figure out making it fit in the list. Here's some code I used a while back, of course, its probably not script manager compatible :-) procedure DotDotDot (var s: str255; var width: integer); var maxwidth, len: integer; begin maxwidth := width; width := StringWidth(s); if width > maxwidth then begin '); {$PUSH} {$R-} len := ord(s[0]); while (len > 0) and (width > maxwidth) do begin width := width - CharWidth(s[len]); len := len - 1; end; len := len + 1; s[0] := chr(len); '; {$POP} end; end; I'm not sure why you want to disable the feature - true it looks a bit strange, but it's what you'd do if you weren't on a computer, seems pretty sensible to me. Have fun, Peter. _______________________________________________________________________ Peter N Lewis Ph: +61 9 368 2055 +++++++++++++++++++++++++++ From: chuck@gte.com (Chuck Hoffman) Date: 15 Jan 93 15:47:49 GMT Organization: GTE Laboratories In article , kurisuto@bach.udel.edu (Sean J. Crist) wrote: > > I wonder if this text-condensing LDEF is some new version written for > System 7. I haven't observed this behavior in earlier systems. > It behaves the same under System 6.0.7 on a IIsi and 7.0.1 on a IIcx. Chuck Hoffman chuck@gte.com GTE Laboratories, Waltham, Massachusetts, USA (617) 466-2131 ===================================== I'm not sure why we're here, but I am sure that while we're here we're supposed to help each other. ===================================== +++++++++++++++++++++++++++ From: lynch@ils.nwu.edu (Richard Lynch) Organization: ILS Date: Fri, 15 Jan 1993 23:01:14 GMT In article , chuck@gte.com (Chuck Hoffman) wrote: > > In article <1993Jan8.233833.3887@mtxinu.COM>, larrym@mtxinu.COM (Larry > Meyer) wrote: > > > > In article Sproul@sproul.sproul.com (Mark Sproul) writes: > > > > > >In article <1993Jan4.061905.14455@midway.uchicago.edu> (comp.sys.mac.programmer), hd12@ellis.uchicago.edu writes: > > >One hint, I just discovered this morning that if the text is longer > > >than the entire width of the window, [ListMgr] will condense the type to > > >make it fit. > > > > > > > Wow, and I though I was just doing something stupid. I encountered > > this condensing "feature" recently, and I haven't been able to the > > goddamn thing off. (No using a monospace font does not work). > > As far as I can tell, this condensing only occurs when > > you use Lists in a Modal Dialog (leading me to suspect that this > > is some hack introduced to aid in displaying long file names > > in the StdFileDlog, or something like that). > > List Manager does this to lists in regular windows, too. If condensing the > text is not enough to make it fit, LM will also truncate the text and put > an elipsis "..." at the end of the part that gets displayed. What I would > like is to turn off the condensing part, and leave on the truncation / > elipsis part. Does anyone know how? I think, the guy who did SoundMaster must know how, since he did it in his control panel... +++++++++++++++++++++++++++ From: winer@husc10.harvard.edu (Adam Winer) Date: 16 Jan 93 09:24:55 GMT Re: getting List Manager to not condense text. To do this, write your own LDEF: if there's interest, I'll post an LDEF which behaves the same as the standard LDEF, but with comments indicating which lines to comment out to remove either or both the condensing and ellipsis adding. I've found that many of the problems of using the List Manager can be solved with a very simple LDEF, and writing a simple LDEF is easy once you have code for one, since you may only need to modify a couple of lines of code. Adam - -- Adam Winer | The number you have reached is imaginary. WINER@HUSC.HARVARD.EDU | Please rotate your phone 90 degrees and | try again. +++++++++++++++++++++++++++ From: jsuker@orion.oac.uci.edu (Johnathon Suker) Date: 19 Jan 93 19:45:36 GMT winer@husc10.harvard.edu (Adam Winer) writes: >Re: getting List Manager to not condense text. >To do this, write your own LDEF: if there's interest, I'll post an LDEF >which behaves the same as the standard LDEF, but with comments indicating >which lines to comment out to remove either or both the condensing and >ellipsis adding. I've found that many of the problems of using the List >Manager can be solved with a very simple LDEF, and writing a simple LDEF >is easy once you have code for one, since you may only need to modify >a couple of lines of code. Adam, I would like code, if you wouldn't mind. Thanks in advance, Johnathon - -- Johnathon Suker | If I were human I believe the proper University of California, Irvine | response would be, 'Go To Hell'. If I Univeristy Library | were human. jlsuker@UCI.EDU | Spock - ST:TUC --------------------------- From: mtc@mundil.cs.mu.OZ.AU (Michael Trevor CUTTER) Subject: File system problem - RstLock not updating... Organization: Computer Science, University of Melbourne, Australia Date: Tue, 19 Jan 1993 00:05:50 GMT Gudday, I have an application that can't be run when it is locked (don't worry, it'll never run off CD-ROM or locked file server). So, rather than worry about dweebs not being able to figure out how to unlock it I automatically unlock it using HRstLock on the application. It works fine - except that the application thinks that it is locked until it quits and runs again. I have tried running FlushVol afterwards, but to no avail. Any suggestions? I need to get the system to realise that the file has been unlocked. Please email or post. Oh yeah, is there a way of telling whether it is locked or not without changing that state? Easy way? - -- Michael Cutter email: mtc@mundil.cs.mu.oz.au Ictinus Network Development Team mtc@arbld.unimelb.edu.au BCAT Development Team snail: c/- 3 Barton Street Department of Architecture & Building Hawthorn, VIC, 3122 University of Melbourne, Australia AUSTRALIA +++++++++++++++++++++++++++ From: absurd@apple.apple.com (Tim Dierks, software saboteur) Date: 19 Jan 93 10:09:27 GMT Organization: MacDTS Marauders In article <9301911.17047@mulga.cs.mu.OZ.AU>, mtc@mundil.cs.mu.OZ.AU (Michael Trevor CUTTER) wrote: > > Gudday, > > I have an application that can't be run when it is locked (don't worry, it'll > never run off CD-ROM or locked file server). > > So, rather than worry about dweebs not being able to figure out how to unlock it > I automatically unlock it using HRstLock on the application. > > It works fine - except that the application thinks that it is locked until it > quits and runs again. > > I have tried running FlushVol afterwards, but to no avail. > > Any suggestions? I need to get the system to realise that the file has been > unlocked. The problem is that when the file is locked, the Process Manager can only open a read-only access path when opening your application to run it. Regardless of any changes to the file's state, that access path remains read-only. Here's my recommendation: if the file's locked and you unlocked it, put up a dialog saying "MacWidget Pro can only run when it is unlocked. The file has been unlocked, but needs to be relaunched. Please run MacWidget Pro again." Because this should happen so rarely, this shouldn't be a huge user problem. This also gives you a good place to put up a dialog saying "MacWidget Pro needs to be unlocked to run. Please unlock MacWidget Pro and run it again." if you couldn't unlock the file. (Because it's on a CD-ROM or file server or locked floppy or whatever.) If you really really can't do this, and you really really need to unlock your file, and you don't care if you've got to fix your app with every new system release from now till doomsday (yes, I'm trying to scare you), and you promise not to tell anyone I told you this, and you didn't hear it here, and you won't bother me when it breaks in a really spectacular way and erases all the hard drives in a 10-mile radius, then you might be able to do what you want to do: you could try looking through the FCB table to find the FCB associated with your app and bashing the "write-OK" flag in the FCB (see the bottom of Inside Mac IV, page 180). You might also need to mark the resource map as read-write. And may God have mercy on your soul. > Oh yeah, is there a way of telling whether it is locked or not without > changing that state? Easy way? Since the question isn't really "is the file locked" but "can I write to the file", you should call GetFCBInfo to get info on your access path to the file (pass the CurResFile() refNum as the refNum you're interested in). You check the same bit I told you not to change up above. Tim Dierks MacDTS, but I speak for myself (hoo-boy, do I) --------------------------- From: jerry@uni-paderborn.de (Gerald Siek) Subject: How to check for gray-scale screen? Date: 19 Jan 1993 15:08:32 GMT Organization: University of Paderborn, Germany Hello wizards, does anyone know how to check whether the user has selected color or gray-scale with the monitors control-panel? I know how to distinguish between color and B/W but how 'bout the gray-scale setting? Any ideas? Any help is greatly appreciated! Thanks in advance! Jerry - -- Gerald Siek - jerry@uni-paderborn.de - University of Paderborn, Germany +++++++++++++++++++++++++++ From: werner@dewey.soe.berkeley.edu (John Werner) Date: 20 Jan 1993 00:47:56 GMT Organization: School of Education, U.C. Berkeley In article <1jh5hhINNcvg@news.uni-paderborn.de> jerry@uni-paderborn.de writes: >does anyone know how to check whether the user has selected color or >gray-scale with the monitors control-panel? For some reason, the 'gdDevType' device attribute tells you whether or not the monitor is color. So once you know what GDevice you're dealing with, it's easy. I have some code in my application that looks like this: // Use "color" drawing on 4-bit color or 8-bit grayscale, or better Boolean useColor = depth >= 8 || (depth >= 4 && TestDeviceAttribute(theDevice, gdDevType)); I hope this helps.... - -- John Werner werner@soe.berkeley.edu UC Berkeley School of Education (510) 596-5868 (new number) --------------------------- End of C.S.M.P. Digest **********************